package com.example.weather.ui

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import com.example.weather.adapter.WeatherForecastAdapter
import com.example.weather.base.BaseBindingFragment
import com.example.weather.databinding.FragmentWeatherForecastBinding
import com.example.weather.model.ForecastData

class WeatherForecastFragment : BaseBindingFragment<FragmentWeatherForecastBinding>() {

    private lateinit var adapter: WeatherForecastAdapter

    override fun initBinding(
        inflater: LayoutInflater,
        parent: ViewGroup?
    ): FragmentWeatherForecastBinding {
        return FragmentWeatherForecastBinding.inflate(inflater, parent, false)
    }

    override fun initView() {
        setupRecyclerView()
    }

    private fun setupRecyclerView() {
        binding.recyclerViewForecast.apply {
            layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
            adapter = WeatherForecastAdapter().apply {
                submitList(ForecastData)
            }
        }
    }
}